#include<bits/stdc++.h>
using namespace std;
int n,ans;
char s[1000010],t[1000010];
int main(){
	freopen("hard.in","r",stdin);
	freopen("hard.out","w",stdout);
	scanf("%d%s%s",&n,s+1,t+1);
	for(int i=1;i<=n;i++)
		if(t[i]=='0') if(i==1||t[i-1]=='1') ans++;
	printf("%d",ans);
	return 0;
}
